import { createSlice } from '@reduxjs/toolkit';  
  
export const quizSlice = createSlice({  
    name: 'quiz',  
    initialState: {  
        quizes: [],  
        loading: false  
    },  
    reducers: {   
        fetchQuizesStart: state => {  
            state.loading = true;  
        },  

        fetchQuizesSuccess: (state, action) => {  
            state.quizes = action.payload;  
            state.loading = false;  
        },  

        fetchQuizesFail: state => {  
            state.loading = false;  
        }  
    }  
});  
  
export const { fetchQuizesStart, fetchQuizesSuccess, fetchQuizesFail } = quizSlice.actions;  
export default quizSlice.reducer;  
